<template>
	<view class="content">
		<view class="content_time">
			{{itemText.datetime}}
		</view>
		<view class="content_item u-flex" :class="itemText.self_side ? 'content_item--right' : 'content_item--left'">

			<u-image :class="itemText.self_side ? 'u-m-l-26' : 'u-m-r-26'" :src="itemText.avatar" :width="91.5"
				:height="91.5"  shape="circle"></u-image>

			<view class="content_item_text">{{itemText.message}}</view>
			<view class="content_item_read" v-if="itemText.self_side == 1"
				:class="[itemText.readed == 1 ?  'content_item_read--read' : 'content_read--service',itemText.self_side ? 'u-m-r-20' : 'u-m-l-20']">
				{{itemText.readed == 1 ? '已读' : '送达'}}
			</view>
		</view>
	</view>
</template>

<script setup>
	import {
		ref,
		watch
	} from 'vue'
	const itemText = ref({})
	const props = defineProps({
		itemText: Object
	})
	watch(()=> props.itemText,(nv)=>{
		itemText.value = nv
	},{
		immediate:true,
		deep:true
	})
</script>
<style scoped lang="scss">
	.content {

		&_time {
			text-align: center;
			margin-top: 30rpx;
			margin-bottom: 30rpx;
			color: #999999;
			font-size: 24rpx;
		}


		&_item--left {
			flex-direction: row;
			margin-left: 30rpx;
		}

		&_item--right {
			flex-direction: row-reverse;
			margin-right: 30rpx;
		}

		&_item {
			font-size: 28rpx;
			height: 100%;
			margin-bottom: 60rpx;

			&_text {
				max-width: 450rpx;
				padding: 24rpx 30rpx;
				word-wrap: break-word;
				background: #fff;
				color: #333333;
				border-radius: 0px 20rpx 20rpx 20rpx;
			}

			&_read {
				font-size: 26rpx;

				&--read {
					color: #c8c8c8;
				}

				&--service {
					color: #00D075;
				}
			}
		}
	}
</style>